using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MBMC.Dialogs.NewWebGallery
{
    public partial class WebGallery : Form
    {
        public WebGallery()
        {
            InitializeComponent();
        }

        private void webBrowser1_FileDownload(object sender, EventArgs e)
        {
            
        }

        private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.ToString().StartsWith("mbmc://"))
            {
                //download file
                e.Cancel = true;
                saveFileDialog1.ShowDialog();
                System.Net.WebClient wc = new System.Net.WebClient();
                toolStripStatusLabel1.Text = "Downloading file....";
                wc.DownloadFile(e.Url.ToString().Substring(0, 6), Application.StartupPath + "/data/gallery/" + saveFileDialog1.FileName);
                toolStripStatusLabel1.Text = "Download completed....";
                
            }
        }

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

        }
    }
}